# Contributor: Leo <thinkabit.ukim@gmail.com>
# Contributor: Michael Koloberdin <koloberdin@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=patchelf
pkgver=0.18.0
pkgrel=3
pkgdesc="Small utility to modify the dynamic linker and RPATH of ELF executables"
url="https://nixos.org/patchelf.html"
arch="all"
license="GPL-3.0-or-later"
subpackages="$pkgname-doc $pkgname-zsh-completion"
source="$pkgname-$pkgver-2.tar.gz::https://github.com/NixOS/patchelf/releases/download/$pkgver/patchelf-$pkgver.tar.gz
	fix-completion.patch
	"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr
	make
}

check() {
	case "$CARCH" in
		ppc64le) ;;
		x86) ;;
		*) make -C tests -j1 check ;;
	esac
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
ff08b24212d90a2d6e5987b181fffaa365efbfe2d4191462dd9d0f6655d78a719df1db0add192764677712e5a37a0efeaafdbaa904021c0d63cf5abfa37ab685  patchelf-0.18.0-2.tar.gz
5c28fe4a918f951c89663aba95b5e10c9290d0cd27edb91fe807b763b4f61b6c2331a9475260eb9a6c9b58640ef2141c533632a116770809d10bb414cc1b2542  fix-completion.patch
"
